package com.xuxin.baby.presenter;

import com.xuxin.baby.bean.BaseBean;
import com.xuxin.baby.bean.ReportBean;
import com.xuxin.baby.contract.UserReportContract;
import com.xuxin.baby.model.UserReportModel;

/**
 * Created by xu_xin
 * Created on 2020/10/23 0023
 * 我的报告
 */
public class UserReportPresenter implements UserReportContract.Presenter {
    private final  UserReportModel model;
    private  final UserReportContract.View view;

    public UserReportPresenter(UserReportContract.View view) {
        this.view = view;
        model = new UserReportModel();
    }

    @Override
    public void getUserReport(String tenantId, String token, String memberId, int skipCount) {
        if (null != model) {
            model.getUserReport(this, tenantId, token, memberId, skipCount);
        }
    }

    @Override
    public void onSuccess(ReportBean reportBean) {
        if (null != view) {
            view.onSuccess(reportBean);
        }
    }

    /**
     * 以下内容复用(用于请求完成后的操作)
     */
    @Override
    public void onError(BaseBean baseBean) {
        if (null != view) {
            view.onError(baseBean);
        }
    }

    @Override
    public void onComplete() {
        if (null != view) {
            view.onComplete();
        }
    }
}